package cyou.breathe.dynamictp.core.config;

import cyou.breathe.dynamictp.core.executor.ThreadPoolExecutorProperties;
import cyou.breathe.dynamictp.core.parser.ConfigFileTypeEnum;
import lombok.Data;

import java.util.List;

/**
 * breatheThread 配置中心参数
 * @author: breathe
 * @createTime: 2025-09-14
 */
@Data
public class BootstrapConfigProperties {

    public static final String PREFIX = "breathe-thread";

    /**
     * 是否开启动态线程池开关
     */
    private Boolean enable = Boolean.TRUE;

    /**
     * Nacos 配置文件
     */
    private NacosConfig nacos;

    /**
     * Nacos 远程配置文件格式类型
     */
    private ConfigFileTypeEnum configFileType;

    /**
     * 通知配置
     */
    private NotifyPlatformsConfig notifyPlatforms;

    @Data
    public static class NotifyPlatformsConfig {

        /**
         * 通知类型，比如：DING
         */
        private String platform;

        /**
         * 完整 WebHook 地址
         */
        private String url;
    }

    /**
     * 线程池配置集合
     */
    private List<ThreadPoolExecutorProperties> executors;

    private static BootstrapConfigProperties INSTANCE = new BootstrapConfigProperties();

    public static BootstrapConfigProperties getInstance() {
        return INSTANCE;
    }

    public static void setInstance(BootstrapConfigProperties properties) {
        INSTANCE = properties;
    }

    @Data
    public static class NacosConfig {

        private String dataId;

        private String group;
    }
}
